updating oE db_get_recid

db_get_recid

include eds.e 
namespace eds 
public function db_get_recid(object key, object table_name = current_table_name) 

returns the unique record identifier (recid) value for the record.

Parameters:
  1. key : the identifier of the record to be looked up.
  2. table_name : optional name of table to find key in
Returns:

An atom, either greater or equal to zero:

  • If above zero, it is a recid.
  • If less than zero, the record wasn't found.
  • If equal to zero, an error occured.
Errors:

If the table is not defined, an error is raised.

Comments:

A recid is a number that uniquely identifies a record in the database. No two records in a database has the same recid value. They can be used instead of keys to quickly refetch a record, as they avoid the overhead of looking for a matching record key. They can also be used without selecting a table first, as the recid is unique to the database and not just a table. However, they only remain valid while a database is open and so long as it does not get compressed. Compressing the database will give each record a new recid value.

Because it is faster to fetch a record with a recid rather than with its key, these are used when you know you have to refetch a record.

Example 1:
rec_num = db_get_recid("Millennium") 
if rec_num > 0 then 
    ? db_record_recid(rec_num) -- fetch key and data. 
else 
    puts(2, "Not found\n") 
end if 
See Also:

db_insert, db_replace_data, db_delete_record, db_find_key

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu